package com.hs.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.HomeCarousel;
import com.hs.mapper.HomeCarouselMapper;
import com.hs.service.HomeCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomeCarouselServiceImpl implements HomeCarouselService {
    @Autowired
    private HomeCarouselMapper homeCarouselMapper;
    @Override
    public HomeCarousel selectById(Integer id) {
        return homeCarouselMapper.selectById(id);
    }

    @Override
    public PageInfo<HomeCarousel> getHomeCarouseByPage(HomeCarousel homeCarousel, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<HomeCarousel> homeCarouseByPage = homeCarouselMapper.getHomeCarouseByPage(homeCarousel);
        PageInfo<HomeCarousel> pageInfo = new PageInfo<>(homeCarouseByPage);
        return pageInfo;
    }
}
